package com.zenika.training.wicket.zencontact.panel;

import java.util.Arrays;
import java.util.Locale;

import org.apache.wicket.PageParameters;
import org.apache.wicket.behavior.HeaderContributor;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.ResourceModel;

import com.zenika.training.wicket.zencontact.pages.AboutPage;

public class MenuPanel extends Panel {

	public MenuPanel(String id) {
		super(id);
		
		// Choice Locale component
		add(new LocaleDropDown("localeSelect", Arrays.asList(new Locale[] { Locale.ENGLISH, Locale.FRENCH })));

			// Add reference to css
			add(HeaderContributor.forCss(MenuPanel.class, "menu.css"));

		// Home Page link
		Label homeLinkLabel = new Label("homeLinkLabel", new ResourceModel("homelink.label"));
		Link homePageLink = new Link("linkHome") {
			public void onClick() {
				setResponsePage(getApplication().getHomePage());
			}
		};
		homePageLink.add(homeLinkLabel);
		add(homePageLink);

		// About Page Link
		PageParameters parameters = new PageParameters();
		parameters.add("name", "value");
		Label aboutLinkLabel = new Label("aboutLinkLabel", new ResourceModel("aboutlink.label"));
		BookmarkablePageLink aboutLink = new BookmarkablePageLink("linkAbout", AboutPage.class, parameters);
		aboutLink.add(aboutLinkLabel);
		
		add(aboutLink);

		
	}
}
